<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>弓友之家</title>
    <link rel="stylesheet" href="css/mui.css" />
    <link rel="stylesheet" href="fonts/iconfont.css" />
    <link rel="stylesheet" href="css/style.css" />
</head>
<body class="signbg">
	<header class="mui-bar mui-bar-nav">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		<h1 class="mui-title">报名入口</h1>
		<a class="mui-icon mui-icon-more-filled mui-pull-right shareBtn"></a>
	</header>
	<style>
		.signbg,.sign{background: #000000;}
		.sign img{width: 100%;} 
		.sign ul{border-bottom: 3px solid #e6a55e;} 
		.sign ul li{border-top: 3px solid #e6a55e; font-size: 23px; padding: 25px 0; text-align: center;}
		.sign ul li a{color: #e6a55e;background-image: -webkit-gradient(linear, 0 0, 0 bottom, from(rgba(243,231,219, 1)), to(rgba(231,167,96, 1)));-webkit-background-clip: text;-webkit-text-fill-color: transparent;}
	</style>
	<div class="mui-content">
		<div class="sign">
			<img src="" class="bg" />
			<ul class="mui-list-unstyled">
				<li><a data-href="sign-rule.html" data-type="0">比赛规则</a></li>
				<li><a data-href="sign-peo.html" data-type="1">个人赛报名入口</a></li>
				<li><a data-href="sign-team.html" data-type="2">团体赛报名入口</a></li>
			</ul>
		</div>   
	</div>
	<!--分享-->
	<div class="shareWx mui-hidden"> 
		<ul class="mui-list-unstyled">
			<li class="tel"><a href="javascript:void(0)" onclick="shareWeixinMessage(1)">微信好友</a></li>
			<li class="qq"><a href="javascript:void(0)" onclick="shareWeixinMessage(2)">朋友圈</a></li>
		</ul>
		<button type="button" class="cancleShare">取消</button>
	</div>
	<script type="text/javascript" src="js/mui.min.js" ></script>
	<script type="text/javascript" src="js/jquery-1.8.3.min.js" ></script>
	<script type="text/javascript" src="js/common.js" ></script>
	<script type="text/javascript" charset="utf-8">
		var shareid=0,personal_status=0,team_status=0;
		var tit="",des="",img="";
		mui.ajax(H_SRC+'/amier/index/match_in',{
			data:{
				token:token,
			},
			dataType:'json',//服务器返回json格式数据
			type:'post',//HTTP请求类型
			timeout:10000,//超时时间设置为10秒；            
			success:function(data){
				var dataurl=data.data;
				if(data.code == 401)
				{
					mui.openWindow({
						url:'login.html',
						id:'login.html'
					})
				}else if(data.code == 1) 
				{
					$(".bg").attr("src",H_SRC+dataurl.match_pic);
					shareid=dataurl.match_id;
					personal_status=dataurl.personal_status;
					team_status=dataurl.team_status;
					tit=data.data.share_title;
					des=data.data.share_desc;
					img=H_SRC+data.data.match_pic;
				}else{ 
					mui.toast(data.msg);
				}
			},
			error:function(){
			}
		}) 
		
      	$(".sign").on("tap","a",function(){
      		if(token==null){
				mui.openWindow({
					url:'login.html',
					id:'login.html',
					createNew:true,
					show: {
						autoShow: true,
						aniShow: 'slide-in-right',
						duration: 200
					}
				});
			}else{
				var href=$(this).attr("data-href");
				var type=$(this).attr("data-type");
				if(type==1){
					if(personal_status==0){
						mui.toast("个人赛报名通道暂未打开！");
						return false;
					}else{
						mui.openWindow({
							url:href,
							id:href,
							createNew:true,
							show: {
								autoShow: true,
								aniShow: 'slide-in-right',
								duration: 200
							} 
						});
					}
				}else if(type==2){
					if(team_status==0){
						mui.toast("团队赛报名通道暂未打开！");
						return false;
					}else{
						mui.openWindow({
							url:href,
							id:href,
							createNew:true,
							show: {
								autoShow: true,
								aniShow: 'slide-in-right',
								duration: 200
							} 
						});
					}
				}else{
					mui.openWindow({
						url:href,
						id:href,
						createNew:true,
						show: {
							autoShow: true,
							aniShow: 'slide-in-right',
							duration: 200
						} 
					});
				}
			}
      	})
      	
      	function shareWeixinMessage(type){
			var type=type;
			if(type==1){
				var secne="WXSceneSession"
			}else{
				var secne="WXSceneTimeline"
			}
			sharewx.send( 
				{ 
					title:tit,
					content:des, 
					href:H_SRC+'/sign/'+shareid,
					thumbs: [img], 
		        	pictures: [img], 
					extra:{scene:secne}
				}, 
				function(){
					mask.close(); 
					$(".shareWx").addClass("mui-hidden");
					mui.toast( "分享成功！" );
				}, function(e){
					mask.close();
					$(".shareWx").addClass("mui-hidden");
					mui.toast( "取消分享");
				}
			);
		}
    </script>
</body>
</html>